﻿#include "changecolor.h"
#include <QDateTime>
#include <QColor>
#include <QVariant>

ChangeColor::ChangeColor(QObject *pExtern, QObject *parent) : QObject(parent), m_pExtern(pExtern)
{
    qsrand(QDateTime::currentDateTime().toTime_t());
    connect(&m_timer, SIGNAL(timeout()), this, SLOT(on_Timer()));
    m_timer.start(1000);
}

void ChangeColor::on_Timer()
{
    QColor color=QColor::fromRgb(qrand() % 255, qrand() % 255, qrand() % 255);
    m_pExtern->setProperty("color", color);
}
